package main

import (
	"encoding/json"
	"fmt"
)

type Student struct {
	ID     int
	Gender string
	name   string // 私有属性不能被JSON包访问
	Sno    string
}

func main() {
	var s1 = Student{
		ID:     12,
		Gender: "男",
		name:   "李四",
		Sno:    "s001",
	}
	fmt.Printf("%#v\n", s1)

	jsonByte, _ := json.Marshal(s1)
	jsonStr := string(jsonByte)
	fmt.Printf("%v", jsonStr)
}
